package data_structure.stack;

import java.util.Stack;

/**
 * @Author: lijun
 * @Date: 2018/11/2 10:16
 */
public class DecodeString {

    public String decodeString(String s) {
        String result = "";
        Stack<Integer> nStack = new Stack<>();
        Stack<String> sStack = new Stack<>();
        int cnt = 0;
        String  t = "";
        for (char c :  s.toCharArray()) {
            if ( c > '0' && c <= '9' ) {
                cnt = 10 * cnt + c - '0';
            } else if (c == '[') {
                nStack.push(cnt);
                sStack.push(t);
                cnt = 0;
                t = "";
            } else if (c == ']') {
                int num = nStack.pop();
                for (int i = 0; i < num; i++) {

                }
            }
        }

        return result;
    }


}
